package com.tedu.charging.service.cost.controller;

import com.tedu.charging.common.pojo.param.ChargingProgressParam;
import com.tedu.charging.common.pojo.vo.ChargingProgressVO;
import com.tedu.charging.service.cost.service.ICostService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/charge/cost")
@Slf4j
public class CostController {
    @Autowired
    ICostService costService;

    /**
     * 接收设备上传的充电数据，
     * @param chargingProgressParam
     * @return 总费用，时长
     */
    @PostMapping("/computataionCost")
    public ChargingProgressVO computataionCost(@RequestBody ChargingProgressParam chargingProgressParam){
        ChargingProgressVO chargingProgressVO = costService.computationalCost(chargingProgressParam);
        return chargingProgressVO;
    }

    /**
     * 获取充电费用，时长信息
     * @param billId
     * @return
     */
    @GetMapping("/getCost/{billId}")
    public ChargingProgressVO getCost(@PathVariable("billId") String billId){
        ChargingProgressVO chargingProgressVO = costService.getCost(billId);

        return chargingProgressVO;
    }


}
